#ifndef FOUNDATION_SETTINGS_CONFIG_PARSER_H
#define FOUNDATION_SETTINGS_CONFIG_PARSER_H
#include "xmlconfig.h"
#include <unordered_map>
#include <vector>
namespace settings {
class ConfigParser {
public:
    ConfigParser();
    ~ConfigParser();

    struct DataCenter {
        std::string name;
        std::string ID;
        std::string key;
        std::string host;
        int32_t port;
        bool isTls;
        int32_t protoType;
        int32_t yunID;
    };

    struct LoginUser {
        std::string user;
        std::string passwd;
    };

    struct Channel {
        int32_t type;
        std::string devPath;
    };

	enum ChnType { CHN_COM = 0, CHN_TCP, CHN_UDP, CHN_LORA, CHN_MAX };
	std::vector<DataCenter> GetDataCenter() const;
    std::vector<LoginUser> GetLoginUsers() const;
    int16_t GetWWWPort() const;
    int32_t GetRetryTimes();
	int32_t GetLogDuration() const;
	std::unordered_map<std::string, Channel> GetChannels() const;
	Channel FindChannel(const std::string &name);

private:
    XmlConfig *xmlConfig_;
};
} // namespace settings
#endif // FOUNDATION_SETTINGS_CONFIG_PARSER_H